package com.chenchen.tiguan.venue.service.impl;

import java.util.List;
import com.chenchen.tiguan.common.utils.DateUtils;
import com.chenchen.tiguan.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.chenchen.tiguan.venue.mapper.VenueCourtMapper;
import com.chenchen.tiguan.venue.domain.VenueCourt;
import com.chenchen.tiguan.venue.service.IVenueCourtService;

/**
 * 场馆下属场地及属性Service业务层处理
 * 
 * @author chenchen
 * @date 2025-04-14
 */
@Service
public class VenueCourtServiceImpl implements IVenueCourtService 
{
    @Autowired
    private VenueCourtMapper venueCourtMapper;

    /**
     * 查询场馆下属场地及属性
     * 
     * @param courtId 场馆下属场地及属性主键
     * @return 场馆下属场地及属性
     */
    @Override
    public VenueCourt selectVenueCourtByCourtId(Long courtId)
    {
        return venueCourtMapper.selectVenueCourtByCourtId(courtId);
    }

    /**
     * 查询场馆下属场地及属性列表
     * 
     * @param venueCourt 场馆下属场地及属性
     * @return 场馆下属场地及属性
     */
    @Override
    public List<VenueCourt> selectVenueCourtList(VenueCourt venueCourt)
    {
        return venueCourtMapper.selectVenueCourtList(venueCourt);
    }

    @Override
    public List<VenueCourt> selectVenueRestCapacity()
    {
        return venueCourtMapper.selectVenueRestCapacity();
    }

    /**
     * 新增场馆下属场地及属性
     * 
     * @param venueCourt 场馆下属场地及属性
     * @return 结果
     */
    @Override
    public int insertVenueCourt(VenueCourt venueCourt)
    {
        venueCourt.setCreateTime(DateUtils.getNowDate());
        venueCourt.setCreateBy(SecurityUtils.getUsername());
        return venueCourtMapper.insertVenueCourt(venueCourt);
    }

    /**
     * 修改场馆下属场地及属性
     * 
     * @param venueCourt 场馆下属场地及属性
     * @return 结果
     */
    @Override
    public int updateVenueCourt(VenueCourt venueCourt)
    {
        venueCourt.setUpdateTime(DateUtils.getNowDate());
        venueCourt.setUpdateBy(SecurityUtils.getUsername());
        return venueCourtMapper.updateVenueCourt(venueCourt);
    }

    @Override
    public int updateVenueCourtRestCapcity(VenueCourt venueCourt)
    {
        return venueCourtMapper.updateVenueCourtRestCapcity(venueCourt);
    }
    /**
     * 批量删除场馆下属场地及属性
     * 
     * @param courtIds 需要删除的场馆下属场地及属性主键
     * @return 结果
     */
    @Override
    public int deleteVenueCourtByCourtIds(Long[] courtIds)
    {
        return venueCourtMapper.deleteVenueCourtByCourtIds(courtIds);
    }

    /**
     * 删除场馆下属场地及属性信息
     * 
     * @param courtId 场馆下属场地及属性主键
     * @return 结果
     */
    @Override
    public int deleteVenueCourtByCourtId(Long courtId)
    {
        return venueCourtMapper.deleteVenueCourtByCourtId(courtId);
    }
}
